<template>
  <div class="common-layout">
    <el-container>
      <el-container>
        <el-aside style="width: 0px; height: 100vh; background-color: #545c64">
          <el-row>
            <el-col>
              <el-menu
                active-text-color="#ffd04b"
                background-color="#545c64"
                class="el-menu-vertical-demo"
                text-color="#fff"
                @open="handleOpen"
                @close="handleClose"
              >
                <el-sub-menu v-for="(item, index) in menu" :key="index" :index="item.index"
                  ><template #title>
                    <el-icon><location /></el-icon>
                    <span>{{ item.title }}</span>
                  </template>
                  <el-menu-item-group v-for="(subItem, subIndex) in item.subs" :key="subIndex">
                    <el-menu-item :index="subItem.index" @="$router.push(subItem.path)">{{
                      subItem.title
                    }}</el-menu-item>
                  </el-menu-item-group>
                </el-sub-menu>
              </el-menu>
            </el-col>
          </el-row>
        </el-aside>
        <el-main style="width: 1250px; position: relative">
          <RouterView />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
export default {
  name: 'App'
}
</script>

<script lang="ts" setup>
import { Document, Menu as IconMenu, Location, Setting } from '@element-plus/icons-vue'
import { pa } from 'element-plus/es/locales.mjs'
import path from 'path'
import { RouterView } from 'vue-router'

const menu = [
  {
    icon: 'Location',
    index: '1',
    title: '低代码功能',
    subs: [
      {
        index: '1-1',
        title: 'form组件',
        path: '/form'
      }
    ]
  }
]

const handleOpen = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
const handleClose = (key: string, keyPath: string[]) => {
  console.log(key, keyPath)
}
</script>
